﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

using Spring.Context;
using Spring.Context.Support;

using YiLe.View.Login;
using YiLe.View.Test;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace YiLe.UI
{
    static class Program
    {
        // Create a logger for use in this class
        public static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        public static void Main()
        {
            try
            {
                if (LOG.IsDebugEnabled)
                {
                    LOG.Debug("项目启动!");
                }
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                //IApplicationContext ctx = ContextRegistry.GetContext();
                //Application.Run(new LoginForm(ctx));
                //Application.Run(new NewLoginForm());

                try
                {
                    //TODO:读取初始化的配置参数，如xml文件
                    //LoadInitConfigFile();
                }
                catch (Exception e)
                {
                    LOG.Debug("启动失败，原因：" + e.Message);
                    return;
                }
                YiLeSystemApp.Initialize();
            }
            catch (Exception e)
            {
                LOG.Error(e.Message);
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }

        /// <summary>
        /// 读取初始化的配置参数，如xml文件
        /// </summary>
        private static void LoadInitConfigFile()
        {
            throw new NotImplementedException();
        }
    }
}
